Field of the Invention
The present invention relates to a communication apparatus and a method of controlling the same.
Description of the Related Art
In recent years, wireless LAN devices have been able to communicate with each other via wireless access points, and the Wi-Fi Alliance has developed the Wi-Fi Direct (registered trademark) standard as a standard for direct communication between wireless LAN devices (Japanese Patent Laid-Open No. 2011-35768). The Wi-Fi Direct standard defines a function for advertising and searching for service information supported by high level applications (service discovery function) as an optional function. Using the service discovery function, service information held by an electronic device that is to be a communication destination can be obtained before executing connection processing, and when service information has been obtained, it is possible to also obtain port information indicating the port that is to be used by the service, and communication can be performed using that port.
However, if the communication partner apparatus does not have the service discovery function, it is not possible to obtain port information indicating the port that is to be used by the service provided by the communication partner apparatus, and therefore communication cannot be performed using that port, and there is a risk of a decrease in user convenience. On the other hand, if all of the ports are opened, there is a possibility of a connection being established by an unintended apparatus, which leads to a decreased level of security.